﻿/*--------------------------------------------------------------------\
|       _____ _                      __  __ _    _  _____ _    _      |
|      / ____| |                    |  \/  | |  | |/ ____| |  | |     |
|     | (___ | |__   __ _ _ __ _ __ | \  / | |  | | (___ | |__| |     |
|      \___ \| '_ \ / _` | '__| '_ \| |\/| | |  | |\___ \|  __  |     |
|      ____) | | | | (_| | |  | |_) | |  | | |__| |____) | |  | |     |
|     |_____/|_| |_|\__,_|_|  | .__/|_|  |_|\____/|_____/|_|  |_|     |
|                             | |                                     |
|                             |_| Copyright(C) Shawn Sagady 2010      |
|=-------------------------------------------------------------------=|
|   Please reference the CREDITS.TXT file for license and credits.    |
\--------------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpMUSH
{
    [Flags]
    public enum LockFlags
    {
        DEFAULT         = 0x0,      // Use default flags when setting lock
        VISUAL          = 0x1,      // Anyone can see this lock with lock()/elock()
        PRIVATE         = 0x2,      // This lock doesn't get inherited
        WIZARD          = 0x4,      // Only Wizards can set/unset this lock
        LOCKED          = 0x8,      // Only the lock's owner can set/unset it
        NOCLONE         = 0x10,     // This lock isn't copied in @clone
        OX              = 0x20,     // This lock's success message includes OX*.
        NOSUCCACTION    = 0x40,     // This lock doesn't have an @a-action for success.
        NOFAILACTION    = 0x80,     // this lock doesn't have an @a-action for failure.
        OWNER           = 0x100     // Lock can only be set/unset by object's owner.
    }

    public enum LockType
    {
        BASIC,
        ENTER,
        USE,
        ZONE,
        PAGE,
        TPORT,
        SPEECH,     // Who can speak aloud in me
        LISTEN,     // Who can trigger ^s/ahears on me
        COMMAND,    // Who can use $commands on me
        PARENT,     // Who can @parent to me
        LINK,       // Who can @link to me
        LEAVE,      // Who can leave me
        DROP,       // Who can drop me
        GIVE,       // Who can give me
        FROM,       // Who can give to me.
        RECEIVE,    // What can be given to me
        MAIL,       // Who can @mail me
        FOLLOW,     // Who can follow me
        EXAMINE,    // Who can examine me
        CHZONE,     // Who can @chzone to this object
        FORWARD,    // Who can @forwardlist to this object
        CONTROL,    // Who can control this object
        DROPTO,     // Who follows the dropto of this room?
        DESTROY,    // Who can @dest me if I'm dest_ok
        INTERACT,
        MAILFORWARD, // Who can forward mail to me
        TAKE,       // Who can take from the contents of this object
        OPEN        // Who can @open exits in this room
    }



    public class Lock
    {
        public LockFlags Flags { get; set; }
        public LockType Type { get; set; }
        public Object Creator { get; set; }
        public string Key { get; set; }

        public Lock(LockType type, string key, Object creator, LockFlags flags)
        {
            Type = type;
            Flags = flags;
            Creator = creator;
            Key = key;
        }

    }
}
